<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ApiSubFour extends Base
{
    protected $table = 'sub_fours';
    protected $hidden = ['created_at','updated_at','chapters','is_zy','is_yct'];

    public static function add($map)
    {
        $list = self::where('question',$map['question'])
            ->get();
        if ($list->isEmpty()){
            $rew = self::create($map);
            if($rew){
                return 200;
            }
        }else{
            return 400;
        }
    }

    public function image()
    {
        return $this->belongsTo('App\Image','url','id');
    }

    public function cate()
    {
        return $this->belongsTo('App\Cate','cate_id','id');
    }

    public function chapters()
    {
        return $this->belongsTo('App\Chapter','chapters_id','id');
    }




}
